# -*- coding: utf-8 -*-
# @Time     : 2021/4/11 13:19
# @Author   : pengrenjie
# @Email    : 941257162@.com
# @File     : 文件操作练习3.py
import random
import string

def ranMAC():
    MAC = '01-AF-3B'
    for i in range(3):
    #从十六进制的字符串中随机选取两个数
        n = random.sample(num,2)
        #拼接选出的两个数，将小写字母转为大写字母
        mac = '-'+''.join(n).upper()
        MAC = MAC + mac
    return MAC
with open('MAC.txt','w+') as fp:

    #得到十六进制的数
    num = string.hexdigits

    for i in range(100):
        print(ranMAC())
        fp.write(f"{ranMAC()}\n")




